1 import os
2 import pickle
3
4 details_list=[]
5 l2=[]
6 G = []
7 def file_save():
8     NAME_PRO = details_list[
0]
9     ADDRESS_PRO = details_list[
1]
10     MOBILE_NO_PRO = details_list[
2]
11     ROOM_NO_PRO = details_list[
3]
12     PRICE_PRO = details_list[
4]
13     f = open(
"hotel.dat", "ab")
14     a=save(NAME_PRO,ADDRESS_PRO,MOBILE_NO_PRO,ROOM_NO_PRO,PRICE_PRO)
15     pickle.dump(a,f,protocol=
2)
16     f.close()
17     restart_program()
18
19
20 def restart_program():
21     python = sys.executable
22     os.execl(python, python, * sys.argv)

23
24
25
26
27
28
29 class
save:
30     def __init__(self, NAME_PRO, ADDRESS_PRO, MOBILE_NO_PRO, ROOM_NO_PRO, PRICE_PRO):
31         self.name=NAME_PRO
32         self.address=ADDRESS_PRO
33         self.mobile_no=MOBILE_NO_PRO
34         self.room_no=ROOM_NO_PRO
35         self.price=PRICE_PRO
36         print(self.name,self.address,self.mobile_no,self.room_no,self.price)
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55 import sys

56
57 try
:
58     
from Tkinter import *
59 except ImportError:
60     
from tkinter import *
61
62 try
:
63     import ttk
64     py3 = False
65 except ImportError:
66     import tkinter.ttk
as ttk
67     py3 = True

68
69
70
71
72
73 class
HOTEL_MANGMENT_checkin:
74     def __init__(self):
75         root = Tk()
76         
'''This class configures and populates the toplevel window.
77            top
is the toplevel containing window.'''
78         _bgcolor =
'#d9d9d9' # X11 color: 'gray85'
79         _fgcolor =
'#000000' # X11 color: 'black'
80         _compcolor =
'#ffffff' # X11 color: 'white'
81         _ana1color =
'#ffffff' # X11 color: 'white'
82         _ana2color =
'#ffffff' # X11 color: 'white'
83         font11 =
"-family {Segoe UI} -size 17 -weight bold -slant " \
84             
"roman -underline 0 -overstrike 0"
85         font14 =
"-family {Times New Roman} -size 16 -weight bold " \
86                  
"-slant roman -underline 0 -overstrike 0"
87
88         root.geometry(
"780x541+504+123")
89         root.title(
"Hotel Management System")
90         root.configure(background=
"#ffffff")
91         root.configure(highlightbackground=
"#ffffff")
92         root.configure(highlightcolor=
"black")
93
94
95
96         self.Labelframe1 = LabelFrame(root)
97         self.Labelframe1.place(relx=
0.01, rely=0.04, relheight=0.95
98                 , relwidth=
0.97)
99         self.Labelframe1.configure(relief=GROOVE)
100         self.Labelframe1.configure(font=font11)
101         self.Labelframe1.configure(foreground=
"black")
102         self.Labelframe1.configure(text=
'''LIST OF ALL GUEST''')
103         self.Labelframe1.configure(background=
"#ffffff")
104         self.Labelframe1.configure(highlightbackground=
"#ffffff")
105         self.Labelframe1.configure(highlightcolor=
"black")
106         self.Labelframe1.configure(width=
760)
107
108         self.Frame1 = Frame(self.Labelframe1)
109         self.Frame1.place(relx=
0.03, rely=0.1, relheight=0.86, relwidth=0.47
110                 , y=-
31, h=15)
111         self.Frame1.configure(relief=GROOVE)
112         self.Frame1.configure(borderwidth=
"2")
113         self.Frame1.configure(relief=GROOVE)
114         self.Frame1.configure(background=
"#d9d9d9")
115         self.Frame1.configure(highlightbackground=
"#ffffff")
116         self.Frame1.configure(highlightcolor=
"black")
117         self.Frame1.configure(width=
355)
118
119         self.Label1 = Label(self.Frame1)
120         self.Label1.place(relx=
0.28, rely=0.02, height=37, width=117)
121         self.Label1.configure(activebackground=
"#ffffff")
122         self.Label1.configure(activeforeground=
"black")
123         self.Label1.configure(background=
"#d9d9d9")
124         self.Label1.configure(disabledforeground=
"#a3a3a3")
125         self.Label1.configure(font=font11)
126         self.Label1.configure(foreground=
"#000000")
127         self.Label1.configure(highlightbackground=
"#ffffff")
128         self.Label1.configure(highlightcolor=
"black")
129         self.Label1.configure(text=
'''NAMES''')
130
131         self.Text1 = Text(self.Frame1)
132         self.Text1.place(relx=
0.06, rely=0.16, relheight=0.8, relwidth=0.88)
133         self.Text1.configure(background=
"white")
134         self.Text1.configure(font=font14)
135         self.Text1.configure(foreground=
"#000000")
136         self.Text1.configure(highlightbackground=
"#d9d9d9")
137         self.Text1.configure(highlightcolor=
"black")
138         self.Text1.configure(insertbackground=
"black")
139         self.Text1.configure(selectbackground=
"#c4c4c4")
140         self.Text1.configure(selectforeground=
"black")
141         self.Text1.configure(width=
314)
142         self.Text1.configure(wrap=WORD)
143
144
145
146         self.Frame2 = Frame(self.Labelframe1)
147         self.Frame2.place(relx=
0.51, rely=0.1, relheight=0.86, relwidth=0.47
148                 , y=-
31, h=15)
149         self.Frame2.configure(relief=GROOVE)
150         self.Frame2.configure(borderwidth=
"2")
151         self.Frame2.configure(relief=GROOVE)
152         self.Frame2.configure(background=
"#d9d9d9")
153         self.Frame2.configure(highlightbackground=
"#ffffff")
154         self.Frame2.configure(highlightcolor=
"black")
155         self.Frame2.configure(width=
355)
156
157         self.Label2 = Label(self.Frame2)
158         self.Label2.place(relx=
0.37, rely=0.02, height=44, width=152)
159         self.Label2.configure(activebackground=
"#ffffff")
160         self.Label2.configure(activeforeground=
"black")
161         self.Label2.configure(background=
"#d9d9d9")
162         self.Label2.configure(disabledforeground=
"#a3a3a3")
163         self.Label2.configure(font=font11)
164         self.Label2.configure(foreground=
"#000000")
165         self.Label2.configure(highlightbackground=
"#ffffff")
166         self.Label2.configure(highlightcolor=
"black")
167         self.Label2.configure(text=
'''ROOM NO.''')
168
169         self.Text2 = Text(self.Frame2)
170         self.Text2.place(relx=
0.06, rely=0.16, relheight=0.8, relwidth=0.88)
171         self.Text2.configure(background=
"white")
172         self.Text2.configure(font=font14)
173         self.Text2.configure(foreground=
"black")
174         self.Text2.configure(highlightbackground=
"#d9d9d9")
175         self.Text2.configure(highlightcolor=
"black")
176         self.Text2.configure(insertbackground=
"black")
177         self.Text2.configure(selectbackground=
"#c4c4c4")
178         self.Text2.configure(selectforeground=
"black")
179         self.Text2.configure(width=
314)
180         self.Text2.configure(wrap=WORD)
181         
for i in range(0,len(G)):
182             s=str(l2[i])
183             h=str(G[i])
184             self.Text1.insert(INSERT,s+
"\n")
185             self.Text2.insert(INSERT,h+
"\n")
186
187
188         root.mainloop()

189
190
191 if
__name__ == '__main__':
192     f2 = open(
"hotel.dat", "rb")
193     
try:
194         
while True:
195             s = pickle.load(f2)
196             k = s.room_no
197             o = s.name.upper()
198             l2.append(o)
199
200             G.append(k)
201             
continue
202
203     except EOFError:
204         pass
205     f2.close()
206     hotel=HOTEL_MANGMENT_checkin()


Gõ tìm kiếm nhanh...